import { useDetail, useList } from "@/hooks";
import { getUserInfoUrl } from "@/command/apiTool";
import { getAction, postAction } from "@/command/netTool";
import * as vant from "vant";
const { showFailToast, showSuccessToast } = vant;
import { useRoute, useRouter } from "vue-router";
export const useRequest = () => {
  const route = useRoute();
  const router = useRouter();

  // 农资列表
  const [listResult] = useDetail("/api/H5/util/getAgriculturalType", []);
  const confirm = (params: any) => {
    console.log("eee", params);

    // applyNo被申请者id
    let quertParams = {
      ...params,
      acceptNo: route.query.id,
    };
    postAction(
      "/api/H5/richMeansOfAgriculturalProduction/small/applyForLarge",
      { ...quertParams },
      { isResolve: true }
    ).then((e: any) => {
      showSuccessToast(e.msg);
      setTimeout(() => {
        router.back();
      }, 500);
    });
  };
  return {
    confirm,
    listResult,
  };
};
